package controllers

import java.io.File

import javax.inject._
import models.Tables.MitochogeneRow
import play.api.libs.json.Json
import play.api.mvc._
import utils.Utils

import scala.concurrent.Await
import scala.concurrent.duration.Duration

/**
 * This controller creates an `Action` to handle HTTP requests to the
 * application's home page.
 */
@Singleton
class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {

  /**
   * Create an Action to render an HTML page with a welcome message.
   * The configuration in the `routes` file means that this method
   * will be called when the application receives a `GET` request with
   * a path of `/`.
   */
  def index : Action[AnyContent] = Action {implicit request=>
    Redirect(routes.HomeController.homeUS())
  }


  def homeUS : Action[AnyContent] = Action{implicit request=>
    Ok(views.html.english.home.home())
  }

  def homeCN : Action[AnyContent] = Action{implicit request=>
    Ok(views.html.chinese.home.home())
  }

  def reference = Action{implicit request=>
    Ok(views.html.english.reference.reference())
  }

  def aboutPage = Action{implicit request=>
    Ok(views.html.english.about.aboutPage())
  }

}
